package com.future.mayi.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.future.mayi.R;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class AssociateAdapter extends BaseRecyclerViewAdapter<String> {

    public AssociateAdapter(Context context, List<String> list) {
        super(context, list);
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new ViewHolder(getView(parent, R.layout.layout_item_associate));
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) {
        ViewHolder holders = (ViewHolder) holder;
        String str = getItem(position);
        holders.tvName.setText(str);
        if (mOnItemClickListener != null)
            holders.tvName.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    mOnItemClickListener.OnItem(v, position);
                }
            });
    }

    class ViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.item_associate_tv)
        TextView tvName;

        public ViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }


}
